#ifndef FIX_HPP
#define FIX_HPP
#include <stdexcept>
namespace myh {
    namespace fix{
        class ExpressionEvaluator {
        protected:
            std::string expression;
        public:
            virtual ~ExpressionEvaluator() = default;
            virtual long long evaluate() const = 0;
            std::string get_expression() const { return expression; }
            long long operator()() const {
                return evaluate();
            }
        };
        class PostfixEvaluator : public ExpressionEvaluator {
        public:
            PostfixEvaluator(const PostfixEvaluator& other) {
                expression=other.expression;
            }
            long long evaluate() const override;
            friend class InfixEvaluator;
        };
        class InfixEvaluator:public ExpressionEvaluator {
        public:
            InfixEvaluator() : ExpressionEvaluator() {}
            explicit InfixEvaluator(const std::string&);
            PostfixEvaluator to_postfix() const;
            long long evaluate() const override {
                return to_postfix().evaluate();
            }
        };
    }
}
#endif